package com.dys.ai.common.enumeration;

/**
 * 座位类型枚举
 * @author 疾风
 */
public enum SeatTypeEnum {
    /**
     * 0：商务座
     */
    BUSINESS(0, "商务座"),

    /**
     * 1: 一等座
     */
    FIRST_CLASS(1, "一等座"),

    /**
     * 2: 二等座
     */
    SECOND_CLASS(2, "二等座");

    /**
     * 枚举编码
     */
    private final int code;

    /**
     * 枚举值
     */
    private final String name;

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    SeatTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static SeatTypeEnum fromName(String name) {
        for (SeatTypeEnum type : values()) {
            if (type.name.equals(name)) {
                return type;
            }
        }
        throw new IllegalArgumentException("无效的座位类型");
    }
}
